package com.databasedesign.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.databasedesign.pojo.po.DormitoryLivein;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
    public interface DormitoryLiveinDao extends BaseMapper<DormitoryLivein> {

    @Insert("INSERT INTO dormitorylivein VALUES (null,#{dormitoryId},#{studentId},#{studentNumber},#{bed})")
        void Insert(Integer dormitoryId,Integer studentId,String studentNumber,Integer bed);

    @Select("SELECT student_number FROM `dormitorylivein` where dormitory_id = #{DormitoryId}")
     List<String> GetStudentNumByDormitoryId(Integer DormitoryId);

    @Select("SELECT dormitory_id FROM `dormitorylivein` where  student_number = #{StudentNumber}")
    Integer GetDorIdByStudentNumber(String StudentNumber);

    @Update("truncate table dormitorylivein")
    void TruncateTable();




}



